#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <assert.h>

int get(int* arr, int n)
{
	int i, j;
	for (i = 0; i < n; i++)
	{
		int count = 0;
		for (j = 0; j < n; j++)
		{
			if (arr[i] == arr[j])
				count++;
			else
				count--;
		}
		if (count > 0)
			return arr[i];
	}
	return 0;
}

int main()
{
	int arr[100] = { 0 };
	int n = 0;
	int i = 0;
	int j = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	int ret = get(arr, n);
	printf("%d", ret);
	return 0;
}